home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK2.toast / Development Kits (Disc 2) / Thread Manager / Thread Manager 2.1.1d1+ / ThreadedSort / Sprocket / Interfaces / Sprocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-28  |  4.4 KB  |  186 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Sprocket.h
  3.  
  4.     Contains:    Prototypes for the “guts” of a Macintosh application.
  5.  
  6.     Written by: Dave Falkenburg
  7.  
  8.     Copyright:    © 1993-1994 by Dave Falkenburg, all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.      
  12.          <6>    11/12/94    DRF        AppConditionals.h is now BuildConditionals.h.  Also revised some
  13.                                     QuickDrawGX stuff.
  14.          <5>     11/8/94    DRF        Add prototype for DragDestinationIsTheTrash.
  15.          <4>     9/27/94    DRF        Changed filename to Sprocket.h. Also made scrap coercion
  16.                                      routines more explicit.
  17.          <3>      9/9/94    DRF        Reordered headers and removed redundant #includes.
  18.          <2>      9/4/94    DRF        Added scroll bar constants.
  19.  */
  20.  
  21. #ifndef        _SPROCKET_
  22. #define        _SPROCKET_
  23.  
  24. #ifndef        _BUILDCONDITIONALS_
  25. #include    "BuildConditionals.h"
  26. #endif
  27.  
  28. #ifndef        __TYPES__
  29. #include    <Types.h>
  30. #endif
  31.  
  32. #ifndef        __WINDOWS__
  33. #include    <Windows.h>
  34. #endif
  35.  
  36. #ifndef        __DIALOGS__
  37. #include    <Dialogs.h>
  38. #endif
  39.  
  40. #ifndef        __STANDARDFILE__
  41. #include    <StandardFile.h>    //    for ModalFilterYDUPP
  42. #endif
  43.  
  44. #ifndef        __DRAG__
  45. #include    <Drag.h>
  46. #endif
  47.  
  48. #include    "Preferences.h"
  49. #include    "Window.h"
  50.  
  51. #if    qUseQuickDrawGX
  52. #include    <FixMath.h>            //    make sure we don’t use GX lame #define of “fixed1”
  53. #include    <graphics types.h>
  54. #endif
  55.  
  56. //    useful macros
  57.  
  58. #if    qDebug
  59. #define    DebugMessage(x)    DebugStr(x)
  60. #else
  61. #define    DebugMessage(x)
  62. #endif
  63.  
  64. //    Resource IDs
  65.  
  66. #define    kErrorAlertID                        128
  67. #define    kStandardCloseAlertID                129
  68. #define    kStandardCloseWithNewPubsAlertID    130
  69.  
  70. #define    kCoreErrorStrings                    128
  71. #define    kUnsupportedSystemSoftware            1
  72. #define    kNeedsThreadManager                    2
  73. #define    kNeedsQuickdrawGX                    3
  74.  
  75. #define    kStandardCloseStrings                129
  76. #define    kQuittingStr                        1
  77. #define    kClosingStr                            2
  78.  
  79. #define    kPreferencesFileStrings                130
  80. #define    kPreferencesFileName                1
  81.  
  82. #define    kSplashPictureID                    128
  83.  
  84. #if        qUseQuickDrawGX
  85. #define    kUseGraphicsSizeResource        0
  86. #define    kAllowGXToExtendGraphicsHeap    ((gxClientAttribute) 0)
  87. #endif
  88.  
  89. //    Useful constants
  90.  
  91. enum
  92.     {
  93.     kScrollbarWidth = 16,    //    width of a standard Macintosh scrollbar
  94.     kScrollbarTweak = 2        //    left edge = rightedge - kScrollbarWidth + kScrollbarTweak
  95.     };
  96.  
  97. //    Useful functions provided by App:
  98.  
  99. void                    HandleEvent(EventRecord *anEvent);
  100. void                    HandleClose(WindowPtr aWindow);
  101.  
  102. short                    StandardAlert(    short alertID,
  103.                                         short defaultItem                = ok,
  104.                                         short cancelItem                = 0,
  105.                                         ModalFilterUPP customFilterProc    = nil);
  106.  
  107. void                    ErrorAlert(short stringList,short whichString);
  108. void                    FatalErrorAlert(short stringList,short whichString);
  109.  
  110. extern ModalFilterUPP    StandardDialogFilter;
  111. extern ModalFilterYDUPP    StandardDialogFilterYD;
  112. extern void                PseudoClickInDialogItem(DialogPtr theDialog, short itemToClick);
  113.  
  114. enum    StandardCloseResult
  115.     {
  116.     kSaveDocument = 1,
  117.     kCancelSaveDocument = 2,
  118.     kDontSaveDocument = 3
  119.     };
  120.  
  121. StandardCloseResult        StandardCloseDocument(const StringPtr documentType,StringPtr documentName, Boolean hasNewEditions, Boolean quitting);
  122.  
  123. OSErr                    CheckAppleEventForMissingParams(AppleEvent *theAppleEvent);
  124.  
  125. short                    OpenPreferencesResFile(void);
  126.  
  127. Boolean                    DragDestinationIsTheTrash(DragReference theDrag);
  128.  
  129.  
  130. //    AOCE “FrontWindow”-equivalent routine for the Standard Mail package
  131. extern FrontWindowUPP    FrontWindowProcForAOCEUPP;
  132.  
  133. //    Globals
  134.  
  135. extern    Boolean                gDone;
  136. extern    Boolean                gMenuBarNeedsUpdate;
  137.  
  138. extern    Boolean                gHasColorQuickdraw;
  139. extern    Boolean                gHasThreadManager;
  140. extern    Boolean                gHasDragManager;
  141. extern    Boolean                gHasAOCE;
  142. extern    Boolean                gHasDisplayManager;
  143.  
  144. #if    qInlineInputAware
  145. extern    Boolean                gHasTextServices;
  146. extern    Boolean                gHasTSMTE;
  147. #endif
  148.  
  149. #if    qUseQuickDrawGX
  150. extern    Boolean                gHasQuickDrawGX;
  151. extern    long                gQuickDrawGXVersion;
  152. extern    long                gQuickDrawGXPrintingVersion;
  153. extern    gxGraphicsClient    gQuickDrawGXClient;
  154. #endif
  155.  
  156. extern    GrafPtr                gWindowManagerPort;
  157. extern    Rect                gDeskRectangle;
  158. extern    RgnHandle            gMouseRegion;
  159.  
  160. extern    short                gPreferencesRsrcRefNum;
  161.  
  162.  
  163. /////////////////////////////////////////////////////////////////
  164. //
  165. //    Routines that the application MUST supply:
  166.  
  167.  
  168. //        intialization & tear down
  169. extern    OSErr    SetupApplication(void);
  170. extern    void    TearDownApplication(void);
  171.  
  172. //        menu handling:
  173. extern    void    HandleMenu(TWindow * topWindowObj,long menuCode);
  174.  
  175. //        scrap coercion hooks:
  176. extern    void    WriteLocalClipboardToScrap(void);
  177. extern    void    ReadLocalClipboardFromScrap(void);
  178.  
  179. //        document handling routines:
  180. extern    OSErr    CreateNewDocument(void);
  181. extern    OSErr    OpenDocument(LetterDescriptor *,void *);
  182. extern    OSErr    PrintDocument(LetterDescriptor *,void *);
  183. extern    Boolean    QuitApplication(void);
  184.  
  185. #endif
  186.